package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.mapper.CompanyInfoMapper;
import com.sfzy.service.CompanyInfoService;
import com.sfzy.entity.CompanyInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyInfoServiceImpl implements CompanyInfoService {
    @Autowired
    private CompanyInfoMapper companyInfoMapper;
    @Override
    public int addCompanyInfo(CompanyInfo companyInfo) {
        return companyInfoMapper.addCompanyInfo(companyInfo);
    }

    @Override
    public CompanyInfo getCompanyInfoById(int id) {
        return companyInfoMapper.getCompanyInfoById(id);
    }

    @Override
    public int updateCompanyInfo(CompanyInfo companyInfo) {
        return companyInfoMapper.updateCompanyInfo(companyInfo);
    }

    @Override
    public int deleteCompanyInfoById(int id) {
        return companyInfoMapper.deleteCompanyInfoById(id);
    }

    @Override
    public List<CompanyInfo> getAllCompanyInfo() {
        return companyInfoMapper.getAllCompanyInfo();
    }

    @Override
    public PageInfo<CompanyInfo> getCompanyInfoByPage(CompanyInfo companyInfo,int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<CompanyInfo> list = companyInfoMapper.getAllCompanyInfo();
        PageInfo<CompanyInfo> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
